package com.example.administrator.demo_one;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.example.administrator.demo_one.Util.InitialPeopleList;
import com.example.administrator.demo_one.VO.People;
import com.example.administrator.demo_one.VO.PeopleAdapter_2;

import java.util.ArrayList;
import java.util.List;

/*
*测试Intent传递数据
* */
public class SecondActivity extends AppCompatActivity {

    private List<People>peoples = new ArrayList<People>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        InitialPeopleList.initialPeopleList(peoples);
        PeopleAdapter_2 peopleAdapter_2 = new PeopleAdapter_2(peoples);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.setAdapter(peopleAdapter_2);
    }
    @Override
    public void onBackPressed(){
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putString("data","江信江疑");
        intent.putExtra("data",bundle);
        setResult(RESULT_OK,intent);
        finish();
    }

}
